package com.example.cwfdemo.controller;

import com.example.cwfdemo.service.RedisService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Carson
 * @Date 2019/8/26 0:25
 */
@RestController
@RequestMapping("/redis")
public class RedisController {

    @Autowired
    private RedisService redisService;

    @ApiOperation(value="setRedis", notes="setRedis")
    @ApiImplicitParam(name = "key-value", value = "key-value", required = true, dataType = "String")
    @GetMapping("/setKeyValue")
    public void setKeyValue(String key,String value){
        redisService.setKeyValue(key,value);
    }

    @GetMapping("/getKeyValue")
    public Object getKeyValue(String key){
        return redisService.getKeyValue(key);
    }
}
